1 #
If _MyType
<> "Empty" Then
5 ''' 用于定义“我的 WPF 命名空间”中的可用属性的模块
7 ''' <remarks></remarks>
8 <Global.Microsoft
.VisualBasic
.HideModuleName()> _
10 Private s_Computer
As New ThreadSafeObjectProvider(Of
Global.Microsoft
.VisualBasic
.Devices
.Computer
)
11 Private s_User
As New ThreadSafeObjectProvider(Of
Global.Microsoft
.VisualBasic
.ApplicationServices
.User
)
12 Private s_Windows
As New ThreadSafeObjectProvider(Of MyWindows
)
13 Private s_Log
As New ThreadSafeObjectProvider(Of
Global.Microsoft
.VisualBasic
.Logging
.Log
)
15 ''' 返回正在运行的应用程序的应用程序对象
17 <Global.System
.Diagnostics
.CodeAnalysis
.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
18 Friend ReadOnly
Property Application() As Application
20 Return Global.System
.Windows
.Application
.Current
26 <Global.System
.Diagnostics
.CodeAnalysis
.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
27 Friend ReadOnly
Property Computer() As Global.Microsoft
.VisualBasic
.Devices
.Computer
29 Return s_Computer
.GetInstance()
33 ''' 返回当前用户的信息。如果希望使用当前的
34 ''' Windows 用户凭据来运行应用程序,请调用 My.User.InitializeWithWindowsUser()。
36 <Global.System
.Diagnostics
.CodeAnalysis
.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
37 Friend ReadOnly
Property User() As Global.Microsoft
.VisualBasic
.ApplicationServices
.User
39 Return s_User
.GetInstance()
43 ''' 返回应用程序日志。可以使用应用程序的配置文件配置侦听器。
45 <Global.System
.Diagnostics
.CodeAnalysis
.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
46 Friend ReadOnly
Property Log() As Global.Microsoft
.VisualBasic
.Logging
.Log
48 Return s_Log
.GetInstance()
53 ''' 返回项目中定义的 Windows 集合。
55 <Global.System
.Diagnostics
.CodeAnalysis
.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
56 Friend ReadOnly
Property Windows() As MyWindows
57 <Global.System
.Diagnostics
.DebuggerHidden()> _
59 Return s_Windows
.GetInstance()
62 <Global.System
.ComponentModel
.EditorBrowsableAttribute(Global.System
.ComponentModel
.EditorBrowsableState
.Never
)> _
63 <Global.Microsoft
.VisualBasic
.MyGroupCollection("System.Windows.Window", "Create__Instance__", "Dispose__Instance__", "My.MyWpfExtenstionModule.Windows")> _
64 Friend NotInheritable Class MyWindows
65 <Global.System
.Diagnostics
.DebuggerHidden()> _
66 Private Shared
Function Create__Instance__(Of T
As {New, Global.System
.Windows
.Window
})(ByVal Instance
As T
) As T
67 If Instance Is
Nothing Then
68 If s_WindowBeingCreated IsNot
Nothing Then
69 If s_WindowBeingCreated
.ContainsKey(GetType(T
)) = True Then
70 Throw
New Global.System
.InvalidOperationException("The window cannot be accessed via My.Windows from the Window constructor.")
73 s_WindowBeingCreated
= New Global.System
.Collections
.Hashtable()
75 s_WindowBeingCreated
.Add(GetType(T
), Nothing)
77 s_WindowBeingCreated
.Remove(GetType(T
))
82 <Global.System
.Diagnostics
.CodeAnalysis
.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
83 <Global.System
.Diagnostics
.DebuggerHidden()> _
84 Private Sub Dispose__Instance__(Of T
As Global.System
.Windows
.Window
)(ByRef instance
As T
)
87 <Global.System
.Diagnostics
.DebuggerHidden()> _
88 <Global.System
.ComponentModel
.EditorBrowsableAttribute(Global.System
.ComponentModel
.EditorBrowsableState
.Never
)> _
92 <Global.System
.ThreadStatic()> Private Shared s_WindowBeingCreated
As Global.System
.Collections
.Hashtable
93 <Global.System
.ComponentModel
.EditorBrowsable(Global.System
.ComponentModel
.EditorBrowsableState
.Never
)> Public Overrides
Function Equals(ByVal o
As Object) As Boolean
94 Return MyBase
.Equals(o
)
96 <Global.System
.ComponentModel
.EditorBrowsable(Global.System
.ComponentModel
.EditorBrowsableState
.Never
)> Public Overrides
Function GetHashCode() As Integer
97 Return MyBase
.GetHashCode
99 <Global.System
.Diagnostics
.CodeAnalysis
.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
100 <Global.System
.ComponentModel
.EditorBrowsable(Global.System
.ComponentModel
.EditorBrowsableState
.Never
)> _
101 Friend Overloads
Function [GetType
]() As Global.System
.Type
102 Return GetType(MyWindows
)
104 <Global.System
.ComponentModel
.EditorBrowsable(Global.System
.ComponentModel
.EditorBrowsableState
.Never
)> Public Overrides
Function ToString() As String
105 Return MyBase
.ToString
110 Partial Class Application
111 Inherits
Global.System
.Windows
.Application
112 <Global.System
.Diagnostics
.CodeAnalysis
.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
113 <Global.System
.Diagnostics
.CodeAnalysis
.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
114 Friend ReadOnly
Property Info() As Global.Microsoft
.VisualBasic
.ApplicationServices
.AssemblyInfo
115 <Global.System
.Diagnostics
.DebuggerHidden()> _
117 Return New Global.Microsoft
.VisualBasic
.ApplicationServices
.AssemblyInfo(Global.System
.Reflection
.Assembly
.GetExecutingAssembly())